home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- NNAAMMEE
- adaed - NYU translator and interpreter for the Ada pro-
- gramming language
-
- SSYYNNOOPPSSIISS
- aaddaaccoommpp [ option ] ... _f_i_l_e
-
- aaddaabbiinndd [ option ] ... [ _l_i_b_r_a_r_y ]
-
- aaddaaeexxeecc [ option ] ... [ _l_i_b_r_a_r_y ]
-
- aaddaalliibb [ _l_i_b_r_a_r_y ]
-
- DDEESSCCRRIIPPTTIIOONN
- Adaed is a translator/interpreter for the Ada programming
- language that is intended primarily for educational use.
- AAddaaccoommpp compiles an Ada program; it invokes in succession
- the three compilation phases: parsing, semantic analysis,
- and code generation. The _f_i_l_e argument refers to the
- source file; if it contains no suffix the Ada source is
- assumed to be in _f_i_l_e_._a_d_a_. It may be a full path name.
- The output of the compiler is an instruction stream for an
- abstract Ada machine, which is subsequently interpreted.
-
- AAddaabbiinndd binds the _l_i_b_r_a_r_y with the specified _m_a_i_n___u_n_i_t to
- form an executable program.
-
- AAddaaeexxeecc invokes the Ada machine interpreter. _L_i_b_r_a_r_y
- specifies a library containing a bound program.
-
- AAddaalliibb is a utility that enables the user to examine the
- contents of the specified library.
-
- Note: all options must precede the file name (for aaddaa--
- ccoommpp), or library name (for aaddaabbiinndd, aaddaaeexxeecc, and aaddaalliibb)
- and must be in lower case.
-
- LLIIBBRRAARRYY
- All compilations require a library. A library is a subdi-
- rectory, which is created or reinitialized when the user
- invokes a command containing --nn option, such as:
- _a_d_a_c_o_m_p _-_n _-_l _l_i_b_n_a_m_e _a_d_a_f_i_l_e
- Intermediate files appear in subdirectory _l_i_b_n_a_m_e. This
- directory is created by the command if it does not already
- exist. Only the listing files are created in the direc-
- tory from which _a_d_a_c_o_m_p is invoked. The _l_i_b_n_a_m_e directory
- should be used to hold files created by the _a_d_a_e_d commands
- only (i.e. those produced by the Ada/Ed system); confusion
- and grief may result if you attempt to use a library
- directory to hold other files. The _l_i_b_n_a_m_e argument may
- be a full path name.
-
- If the environment variable ADALIB is defined, its value
- is used as a default library and the --ll option (including
-
-
-
- NYU Ada Group 23 September 1991 1
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- its _l_i_b_n_a_m_e argument) to _a_d_a_c_o_m_p can be omitted. Simi-
- larly, if ADALIB is defined then the library name need not
- be provided to _a_d_a_b_i_n_d_, _a_d_a_e_x_e_c, and _a_d_a_l_i_b.
-
- A given utility library, UL (e.g. one that contains mathe-
- matical functions) may be used by several unrelated pro-
- grams. It may then be convenient to create independent
- libraries for each program, and initialize each library
- with the contents of UL. This can be done simply by cre-
- ating directories for each library, and copying the con-
- tents of UL into each of these.
-
- OOPPTTIIOONNSS
- The options for _a_d_a_c_o_m_p are as follows:
-
- --aa Generates instructions for use by the
- interpreter (_a_d_a_e_x_e_c command) to trace the
- Ada source lines. Used in conjunction with
- the --tt aa option of adaexec.
-
- --bb Indicates that the binding of the library
- is to be performed if the current compila-
- tion is completed without errors.
-
- --gg Specifies that the compiler is to produce a
- listing of the generated instructions for
- the Ada machine (of little interest to most
- users).
-
- --ii_x This is an option to the binder and is rel-
- evant only if the --bb option is used. See
- options for _a_d_a_b_i_n_d below.
-
- --ll_l_i_b_r_a_r_y Uses the specified library to satisfy ref-
- erences to compilation units not present in
- the file being compiled. If the compilation
- is successful, the units defined in the
- file are added to the library. If this
- option is not specified explicitly, a
- default library is implicitly defined by
- the ADALIB environment variable.
-
- --mm_u_n_i_t___n_a_m_e This is an option to the binder and is rel-
- evant only if the --bb option is used. See
- options for _a_d_a_b_i_n_d below.
-
- --nn Indicates that a new library is to be cre-
- ated for this compilation. The name of the
- library is indicated by the --ll option or
- through the ADALIB environment variable.
- The --nn option must be specified if the
- library referenced by the --ll option (or the
- ADALIB environment variable) does not
- already exist or must be reinitialized.
-
-
-
- NYU Ada Group 23 September 1991 2
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- --ss Produces a listing of the source file. The
- name of the listing file is the input file
- name prefix with suffix _._l_i_s. By default,
- no listing file is generated unless there
- are warnings, errors or informational mes-
- sages to report.
-
- --vv Gives a (verbose) descriptive trace showing
- the subsidiary programs invoked by the _a_d_a_-
- _c_o_m_p command, the options and arguments
- passed to them, and their exit status.
- This is used primarily for system checkout.
-
- The options for _a_d_a_b_i_n_d are as follows:
-
- --mm_u_n_i_t___n_a_m_e Specifies the name of the unit which is to
- serve as a main program. When the library
- contains only one main program (which must
- be a parameterless procedure) this option
- is not needed.
-
- --ii_x To be used for programs that use pprraaggmmaa
- INTERFACE. _x designates the non-Ada inter-
- faced procedures and may be a) the name of
- an object file, created by the user, of the
- form _f_i_l_e_n_a_m_e_._o (that appears in the same
- directory as the Ada program); or b) an
- abbreviation for the library '/lib/lib_x.a'.
- If that does not exist then
- '/usr/lib/lib_x.a' is searched. This
- library is unrelated to the Ada program
- library referenced by the various _a_d_a_e_d
- commands, and generally refers to a stan-
- dard library provided for another program-
- ming language. This option may be used as
- many times as necessary, providing that
- each use represents only a single file or
- library. Thus, _a_d_a_b_i_n_d _-_i _a_._o _-_i _b_._o _-_i
- _l_i_b _._._. is acceptable, while _a_d_a_b_i_n_d _-_i _a_._o
- _b_._o _l_i_b _._._. is not. To use this option,
- the environment variable INT must be set to
- point to the directory containing the file
- _a_d_a_i_n_t (see the Setup file or your system
- manager). Usage examples appear below.
-
- The options for _a_d_a_e_x_e_c are as follows:
-
- --mm_b_o_u_n_d___m_a_i_n___u_n_i_t
- Specifies the name of the bound main unit, i.e.
- the main unit that was specified to _a_d_a_b_i_n_d, or
- _a_d_a_c_o_m_p. Note that a given library may have been
- bound several times with different main units.
- When the library has been bound with only one
- main unit, this option is not needed.
-
-
-
- NYU Ada Group 23 September 1991 3
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- --hh_h_e_a_p___s_i_z_e
- Specify the size of the heap increment in kilo-
- words, by which the heap is expanded when the
- elaboration of a new entity requires it. The
- heap expands to fill available memory. The
- default increment is 128. This parameter limits
- the size of the largest object that can be cre-
- ated in a program.
-
- --pp_p___s_i_z_e Specifies the size in bytes of the program stack
- size for the main task. The default is 10000.
- Argument values in the range 1..31 are multi-
- plied by 1024 to obtain the stack size in
- bytes. The maximum value is 32767.
-
- --ss_t___s_i_z_e Specifies the size in bytes of the stack size
- for each new task. The default is 10000. Argu-
- ment values in the range 1..31 are multiplied by
- 1024 to obtain the stack size in bytes. Use of
- small stack sizes may be appropriate when exe-
- cuting programs with many tasks, each of which
- can run with a small stack. The maximum value
- is 32767.
-
- --tt_t_r_a_c_e___o_p_t_i_o_n_s
- Specify one or more of the following letters
- indicating the kind of trace(s) requested for
- the execution of the program.
-
- aa (Ada line) Display the source line num-
- bers. This requires that
- the program be compiled with
- the --aa option.
-
- cc (calls) Display the name of each
- subprogram as it is entered
- and exited.
-
- ee (exceptions) Display the name of each
- exception as it is raised.
-
- rr (rendezvous) Trace each rendezvous.
-
- tt (tasks) Display task creation, acti-
- vation, and termination.
-
-
- EEXXAAMMPPLLEESS
- The following examples show typical usage:
-
-
- 1) Compile t1.ada into a new library called testlib
- and bind the library; then execute it. The
- listing is written to t1.lis. Note that --ss is
-
-
-
- NYU Ada Group 23 September 1991 4
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- used to force a listing file to be created.
- _a_d_a_c_o_m_p _-_s _-_n_l _t_e_s_t_l_i_b _-_b _t_1
- _a_d_a_e_x_e_c _t_e_s_t_l_i_b
-
- 2) Compile a package specification in p.spc and
- corresponding body in p.bod into a new library
- called tstlib. Then compile t2.ada into the
- same library, bind the main program, and execute
- it
- _a_d_a_c_o_m_p _-_n_l _t_s_t_l_i_b _p_._s_p_c
- _a_d_a_c_o_m_p _-_l _t_s_t_l_i_b _p_._b_o_d
- _a_d_a_c_o_m_p _-_l _t_s_t_l_i_b _-_b _t_2
- _a_d_a_e_x_e_c _t_s_t_l_i_b
-
-
- 3) In the example above, the binding could be done
- in a separate phase. This is achieved by
- replacing the third command above with:
- _a_d_a_c_o_m_p _-_l _t_s_t_l_i_b _t_2
- _a_d_a_b_i_n_d _t_s_t_l_i_b
-
-
- 4) Example 2 above could be done without explicitly
- specifying the library by setting the environ-
- ment variable ADALIB, as follows:
- _s_e_t_e_n_v _A_D_A_L_I_B
- my_default_directory
- _a_d_a_c_o_m_p _-_n _p_._s_p_c
- _a_d_a_c_o_m_p _p_._b_o_d
- _a_d_a_c_o_m_p _-_b _t_2
- _a_d_a_e_x_e_c
-
-
-
- 5) Compile a program with line numbers included in
- the generated code. Execute it displaying Ada
- source line numbers as they are encountered.
- _a_d_a_c_o_m_p _-_a _-_n_l _l_i_b_n_a_m_e _-_b _t_1
- _a_d_a_e_x_e_c _-_t _a _l_i_b_n_a_m_e
-
- 6) Compile a program with two parameterless proce-
- dures (potential main programs) which are named
- MAIN1 and MAIN2 in files p1.ada and p2.ada
- respectively, and bind the library _t_s_t_l_i_b using
- MAIN1 as the main program.
- _a_d_a_c_o_m_p _-_n_l _t_s_t_l_i_b _p_1
- _a_d_a_c_o_m_p _-_l _t_s_t_l_i_b _p_2
- _a_d_a_b_i_n_d _-_m _m_a_i_n_1 _t_s_t_l_i_b
- _a_d_a_e_x_e_c _t_s_t_l_i_b
-
- 7) Suppose we wish to add another program to the
- library tstlib (created in Example 6) whose main
- program unit is named MAIN3 and appears in file
- p3.ada. The following commands will compile and
-
-
-
- NYU Ada Group 23 September 1991 5
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- execute MAIN3. As tstlib was previously bound
- with MAIN1 as a main unit, it is now necessary
- to use the --mm option to _a_d_a_e_x_e_c in order to
- select the desired bound main unit.
- _a_d_a_c_o_m_p _-_l _t_s_t_l_i_b _p_3
- _a_d_a_b_i_n_d _-_m _m_a_i_n_3 _t_s_t_l_i_b
- _a_d_a_e_x_e_c _-_m _m_a_i_n_3 _t_s_t_l_i_b
-
- 8) The contents of the library above can be exam-
- ined by:
- _a_d_a_l_i_b _t_s_t_l_i_b
- _A_d_a_l_i_b writes the name, type and compilation
- date of each unit in the specified library to
- standard output. In addition, it writes the
- current status (active or obsolete) of each
- unit. Units which may be main programs are noted
- by "(Main)"; if there is more than one such
- unit, the --mm option to adabind must be specified
- during binding. Libraries that have been bound
- will contain at least one unit labeled "binding
- unit". If several of these are active, the --mm
- option must be specified for _a_d_a_e_x_e_c.
-
- PPRRAAGGMMAA IINNTTEERRFFAACCEE
- Pragma interface (LRM 13.9) is currently supported for
- interfacing to subprograms written in FORTRAN or C.
-
- Arguments to interfaced procedures must be one of the fol-
- lowing types:
- For C: integer, float, access, array, record, and enumera-
- tion types.
- For FORTRAN: integer, float and array. The return types
- available are integer and float.
-
- Following are sample Ada programs that are interfaced to
- subprograms coded in FORTRAN and C, together with the code
- for the interfaced subprograms:
-
- 1) Interface to FORTRAN
-
- C This is a source file called _f_u_n_c_._f which contains two
- functions to be used in an
- C Ada program with pragma INTERFACE.
-
- function sqr(x)
- sqr = x*x
- return
- end
-
- function cube(x)
- cube = x*x*x
- return
- end
-
-
-
-
- NYU Ada Group 23 September 1991 6
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- -- Assume that the following are the contents of file
- _f_o_r_t_l_i_b_._a_d_a.
- -- It contains a compilation unit that defines two func-
- tions which are
- -- interfaced to the above routines.
-
- ppaacckkaaggee FORTRAN_LIB iiss
- ffuunnccttiioonn SQR(X:FLOAT) rreettuurrnn FLOAT;
- ffuunnccttiioonn CUBE(X:FLOAT) rreettuurrnn FLOAT;
- pprriivvaattee
- pprraaggmmaa INTERFACE(FORTRAN, SQR);
- pprraaggmmaa INTERFACE(FORTRAN, CUBE);
- eenndd FORTRAN_LIB;
-
- wwiitthh FORTRAN_LIB, TEXT_IO; uussee FORTRAN_LIB, TEXT_IO;
- pprroocceedduurree TEST iiss
- ffuunnccttiioonn SQRT(X : FLOAT) rreettuurrnn FLOAT;
- pprraaggmmaa INTERFACE(C,SQRT);
- ppaacckkaaggee MY_FLOAT_IO iiss nneeww FLOAT_IO(FLOAT); uussee
- MY_FLOAT_IO;
- bbeeggiinn
- PUT(SQR(2.0));
- NEW_LINE;
- PUT(CUBE(2.0));
- NEW_LINE;
- PUT(SQRT(2.0));
- NEW_LINE;
- eenndd TEST;
-
- To compile and execute, enter the following commands:
- _f_7_7 _-_c _f_u_n_c_._f
- _a_d_a_c_o_m_p _-_n_l _t_e_s_t_l_i_b _-_b _-_i _f_u_n_c_._o _f_o_r_t_l_i_b
- _a_d_a_e_x_e_c _t_e_s_t_l_i_b
- The output will be:
- 4.00000E+00
- 8.00000E+00
- 1.41421E+00
-
- 2) Interface to C
-
- /*
- * Source file _p_r_o_c_._c contains procedures PRINTA and
- PRINTS1 called by
- * the Ada program above.
- */
- printa(ara)
- int ara[];
- {
- int i;
- for (i=0;i<10;i++) {
- printf("%d ",ara[i]);
- }
- printf("\n");
- }
-
-
-
- NYU Ada Group 23 September 1991 7
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- prints1(ara,len)
- int ara[];
- int len;
- {
- int i;
- for (i=0;i<len;i++) {
- printf("%c",ara[i]);
- }
- printf("\n");
- }
-
- -- Assume that file _t_e_s_t___i_n_t_e_r_f_a_c_e_._a_d_a contains the fol-
- lowing program:
- pprroocceedduurree C_INTERFACES iiss
- ttyyppee ARA10 iiss aarrrraayy(1..10) ooff INTEGER;
- A10: ARA10 := (1,2,3,4,5,6,7,8,9,10);
-
- pprroocceedduurree PRINTA(A:ARA10);
- -- PRINTA prints an array of 10 elements of type
- INTEGER
- pprraaggmmaa INTERFACE(C, PRINTA);
-
- pprroocceedduurree PRINTS1(A:STRING; LEN: INTEGER);
- -- PRINTS1 prints an array of LEN elements of type
- CHARACTER
- pprraaggmmaa INTERFACE(C, PRINTS1);
-
- pprroocceedduurree PRINTS(A:STRING) iiss
- -- This routine prints a string by passing the string
- and its length
- -- to the routine PRINTS1 which is written in C.
- bbeeggiinn
- PRINTS1(A, A'length);
- eenndd;
-
- bbeeggiinn
- PRINTA(A10);
- PRINTS("this is any string");
- eenndd;
-
- To compile and execute, enter the following:
- _c_c _-_c _p_r_o_c_._c
- _a_d_a_c_o_m_p _-_i _p_r_o_c_._o _-_n_l _t_e_s_t_l_i_b _-_b
- _t_e_s_t___i_n_t_e_r_f_a_c_e
- _a_d_a_e_x_e_c _t_e_s_t_l_i_b
-
- The resulting output is as follows:
- 1 2 3 4 5 6 7 8 9 10
- this is any string
-
-
- EENNVVIIRROONNMMEENNTT
- The environment variable AADDAALLIIBB contains the name of the
- library used if none is specified on the command line.
-
-
-
- NYU Ada Group 23 September 1991 8
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- Normally the executables called by aaddaaccoommpp and the prede-
- fined libraries are in a directory built into the system.
- The directory containing these can be specified by the
- environment variable AADDAAEEDD which overrides the built in
- directory name.
-
- The location of individual components called by aaddaaccoommpp or
- the location of the predefined libraries can be overridden
- with the following environment variables: PPRRSS For the
- parser, aaddaapprrss;; SSEEMM For the semantic analyzer, aaddaasseemm;; GGEENN
- For the code generator, aaddaaggeenn;; BBNNDD For the binder,
- aaddaabbiinndd;; and AADDAAEEDDPPRREEDDEEFF For the predefined libraries.
-
- FFIILLEESS
- file.ada Ada source file
- adaint partially built interpreter (used for pragma
- interface)
- predef.axq symbol table for predef
- predef.trc tree file for predef
- predef.lib library for predef
-
- DDIIAAGGNNOOSSTTIICCSS
- Adaed commands return an exit code of 0 in the case of
- success, and nonzero otherwise. An error code of 1 indi-
- cates errors in usage of the Ada language, 2 is returned
- if there is an internal Adaed system error, and 3 denotes
- some invalid usage of the Adaed system. Error messages
- regarding invalid system usage are directed to the stan-
- dard error file. Ada language related messages detected
- at compilation are written to the listing file, while
- those detected by _a_d_a_b_i_n_d or _a_d_a_e_x_e_c appear on standard
- output.
-
- Note, that an error in a given compilation unit may cause
- subsequent compilation units (within the same compilation)
- not to be recognized.
-
- AAUUTTHHOORRSS
- Ada/Ed-C was written by the following members of the NYU
- Ada Project: Bernard Banner, Jerome Chiabaut, Robert
- Dewar, Anne Dinning, Alain Lauque, Gail Schenker Morgulis,
- Brett Porter, Jean-Pierre Rosen, Edmond Schonberg, David
- Shields, Brian Siritzky, Franck Triplet.
-
- BBUUGGSS
- We give absolutley no warranty as to the correctness of
- the system. It was designed strictly for teaching pur-
- poses. Currently it is unvalidated although we hope to put
- it in a validatable shape in the near future.
-
- Any compilation or execution that terminates abnormally
- with mention of _i_n_t_e_r_n_a_l _e_r_r_o_r has uncovered a bug that
- should be reported to the NYU Ada group.
-
-
-
-
- NYU Ada Group 23 September 1991 9
-
-
-
-
-
- ADAED() Unix Programmer's Manual ADAED()
-
-
- NYUADA project
- New York University
- 251 Mercer Street
- New York, N.Y. 10012
- (212) 998 - 3480
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- NYU Ada Group 23 September 1991 10
-
-
-